package projectVersion;

import java.text.SimpleDateFormat;
import java.util.Date;

import projectVersion.ResLoader.State;

public class ProjectVersionHandler extends Handler{

	public ProjectVersionHandler(String path) {
		super(path);
	}

	private String getVersion() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
		return sdf.format(new Date());
	}
	
	@Override
	boolean custHandleLine(String lineStr, State state, StringBuilder sb) {
		if (lineStr.startsWith("project.version")) {
			String version = getVersion();
			System.out.println("版本号：" + version);
			sb.append("project.version=")
				.append(version);
			return true;
		}
		return false;
	}
}
